#!/bin/bash

################################################################################
#
# This file allows setting of custom camera configurations by defining what
# sensors are plugged into which port.
#
# There is no guarantee that any arbitrary configuration will work. Only the
# predefined camera configs at https://docs.modalai.com/voxl2-camera-configs/
# are supported.
#
# each slot can be one of the following sensors:
#
# pmd-tof
# pmd-tof-liow2
# ov7251
# ov7251-combo
# ov9782
# ov9782-combo
# ar0144
# ar0144-fsin
# ar0144-fsin-combo
# imx214
# imx412
# imx678
#
#
# When using a combo mode pair, you must also add a JX_COMBO_MODE field which
# specifies is the pair is to be set up as either a stereo pair ordered
# left-right, right-left, or treated as two independent cameras. If you are
# using a combo-mode flex but only physically connect one of the two cameras
# then select "single" it does not matter which one you connect.
#
# For example:
# J6_LOWER_COMBO_MODE="left-right"
# J6_LOWER_COMBO_MODE="right-left"
# J6_LOWER_COMBO_MODE="independent"
# J6_LOWER_COMBO_MODE="single"
#
# when running "independent" combo mode, also add a NAME2 field for the second cam
# e.g J6_LOWER_NAME2="tracking_rear"
#
# for all sensors except TOF, you can specify a "rotate" flag to
# rotate the image 180 degrees e.g. J6_LOWER_ROTATE="true" or "false"
# for stereo pairs (e.g. ov7251 combo or ar0144-slave-strereo) you can specify
# "rotate-first-only" or "rotate-second-only" to only rotate one, other wise
# when setting the rotate option to "true" both will be rotated.
#
#
# Once configured, this file should live in /data/modalai/custom_camera-config.txt
# then run voxl-configure-cameras custom to load it in
#
#
# cp /usr/share/modalai/voxl-camera-server/custom_camera_config.txt /data/modalai/
#
# We also suggest changing your /data/modalai/sku.txt file to have a camera
# config term "CC" such as MRB-D0005-4-V2-CC
################################################################################

################################################################################
# Camera config 47A: hardware sub-revision A of config 47
#
# Same sensors as config 47 (IMX664 hires + two AR0144 tracking cameras + Boson),
# with these rev A hardware differences:
#   - IMX664 hires camera is connected to J8 upper (slot 5) instead of J7 lower (slot 2)
#   - forward tracking camera is mounted upside down, so it is rotated 180 degrees
#   - downward tracking camera is mounted rotated 90 degrees, so it uses the
#     rotated sensor type which rotates its encoded stream
# Everything else matches config 47.
#
# Select with:  voxl-configure-cameras 47A
# (voxl-configure-cameras falls back to config 47 if this file is absent)
################################################################################

# enable the fsync pin for M0173 to drive tracking cameras
FSYNC_GPIO="109"
FSYNC_EN=true


J6_LOWER_SENSOR="ar0144-fsin-combo"
J6_LOWER_NAME="tracking_front"
J6_LOWER_ROTATE="true"

# down camera is mounted rotated 90 degrees on rev A, the rotated sensor
# type rotates the encoded stream to match
J6_LOWER_COMBO1_SENSOR="ar0144-fsin-combo-rotated"
J6_LOWER_COMBO1_NAME="tracking_down"
J6_LOWER_COMBO1_ROTATE="false"

J8_UPPER_SENSOR="imx664-fpv"
J8_UPPER_NAME="hires"
J8_UPPER_ROTATE="false"


J8_LOWER_SENSOR="boson-fpv"
J8_LOWER_NAME="boson"
J8_LOWER_ROTATE="false"



